package com.staff.dao;

import java.util.List;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;
import com.staff.entity.Staff;
import com.staff.entity.StaffArchive;


@Repository
public interface StaffRepository 
	extends PagingAndSortingRepository<Staff, Long>,JpaSpecificationExecutor<Staff> {
	
	@Query("from Staff s where s.staffNum=?1")
	public Staff findOne(String staffNum);
	@Query("from Staff s where s.staffNum=?1 and s.password=?2")
	public Staff findStaff(String staffNum, String password);
	
	@Query("from Staff s where s.staffName=?1")
	public List<Staff> findStaffByName(String Name);
	@Query("from StaffArchive sa where sa.staff.id = ?1")
	public StaffArchive findStaffArchive(Long staffId);
	@Query("from Staff s where s.department.id = ?1")
	public List<Staff> findByDept(Long deptId);
}
